# -*- coding:utf-8 -*-
"""
Created on Apr 29, 2011

@author: Lithuanian
"""
from algorithm import Heuristic

class keepYourDistance:
    
    def evaluate(self, problem_state):
        penalty = 0
        for robot in problem_state.robots:
            for nextRobot in problem_state.robots:
                if robot[0] == nextRobot[0] and robot[1] == nextRobot[1]:
                    continue
                if abs(robot[0]-nextRobot[0]) <= 1 \
                   and abs(robot[1]-nextRobot[1]) <= 1:
                    penalty += 1
        delta = len(problem_state.dirt_locations)
        return delta*penalty